<?php
/**
 * Search bar for lets manager, it allows search ask / offer or member and it is displayed on all pages
 *
 * @package    letsManager
 * @subpackage form
 * @author     Jerome Fouilloy
 * @version    SVN: $Rev$
 */
class LetsSearchBarForm extends BaseForm
{
  const TYPE_MEMBER = 'member';
  const TYPE_ASK = 'ask';
  const TYPE_OFFER = 'offer';
  
  public function setup()
  {
    parent::setup();
    $this->widgetSchema['type'] = new sfWidgetFormChoice(array(
      'choices'=> array(self::TYPE_MEMBER=>"Adhérents",self::TYPE_ASK=>"Demandes",self::TYPE_OFFER=>"Offres"),
    ));
    $this->validatorSchema['type'] = new sfValidatorChoice(array(
      'choices'=>array(self::TYPE_MEMBER,self::TYPE_ASK,self::TYPE_OFFER),
    ));
    $this->widgetSchema['query'] = new sfWidgetFormInputText();
    $this->validatorSchema['query'] = new sfValidatorString(array('min_length'=>2),array('min_length'=>'Saisir au moins 2 lettres'));
    
    $this->widgetSchema->setLabels(array('type'=>"Dans :",'query'=>"Mot clef :"));
  }
}